import { pubRequire } from '@utils/public'
const baseUrl = '/integrals/commoditys'
/* 商品列表 */
export function getCommodity(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}`, obj, callBack, errBack)
}
/* 商品下架 */
export function commoditysDisable(id, {}, callBack, errBack) {
  return pubRequire('patch', `${baseUrl}/disable/${id}`, {}, callBack, errBack)
}
/* 商品上架 */
export function commoditysEnable(id, {}, callBack, errBack) {
  return pubRequire('patch', `${baseUrl}/enable/${id}`, {}, callBack, errBack)
}
/* 删除商品 */
export function deleteCommodity(id, {}, callBack, errBack) {
  return pubRequire('delete', `${baseUrl}/${id}`, {}, callBack, errBack)
}
// 获取礼品卡
export function getGiftCard(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/items`, obj, callBack, errBack)
}
/* 校验礼品卡是否绑定过商品 */
export function giftCardExist(id, {}, callBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/gift-card-exist/${id}`,
    {},
    callBack,
    errBack
  )
}
/* 新增商品 */
export function addCommodity(obj, callBack, errBack) {
  return pubRequire('post', `${baseUrl}`, obj, callBack, errBack)
}
/* 获取商品详情 */
export function commodityDetail(id, {}, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/${id}`, {}, callBack, errBack)
}
/* 编辑商品 */
export function editCommodity(id, obj, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}`, obj, callBack, errBack)
}
